/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.wpi.first.wpilibj.templates;

import java.util.Vector;
import edu.wpi.first.wpilibj.DriverStationLCD;

/**
 *
 * @author Administrator
 */
public class DriverStationPrinter {
    private Vector m_vLines;
    private DriverStationLCD m_drlcd;
    private static DriverStationPrinter inst = null;
    private DriverStationPrinter() {
        m_vLines = new Vector();
        m_vLines.addElement("                           ");
        m_vLines.addElement("                           ");
        m_vLines.addElement("                           ");
        m_vLines.addElement("                           ");
        m_vLines.addElement("                           ");
        m_drlcd = DriverStationLCD.getInstance();
    }

    public void println(String strLine) {
        String strTempLine = strLine;
        for (int i = 0; i < (27 - strLine.length()); i++) {
            strTempLine += " ";
        }
        m_vLines.insertElementAt(strLine, 0);
        m_vLines.removeElementAt(5);
        m_drlcd.println(DriverStationLCD.Line.kUser2, 1, (String) m_vLines.elementAt(0));
        m_drlcd.println(DriverStationLCD.Line.kUser3, 1, (String) m_vLines.elementAt(1));
        m_drlcd.println(DriverStationLCD.Line.kUser4, 1, (String) m_vLines.elementAt(2));
        m_drlcd.println(DriverStationLCD.Line.kUser5, 1, (String) m_vLines.elementAt(3));
        m_drlcd.println(DriverStationLCD.Line.kUser6, 1, (String) m_vLines.elementAt(4));
        m_drlcd.updateLCD();
    }

    public static DriverStationPrinter getInstance() {
        if (inst == null)
            inst = new DriverStationPrinter();
        return inst;
    }
}
